
package com.hd2.controlhd.controller;

import com.hd2.controlhd.dao.usuarioDAO;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Dulcyelliton
 */
public class usuarioController {

    private static usuarioController instance;
    
    public boolean acessarSistema(String login, String senha){
        try {
            usuarioDAO usuarioD = usuarioDAO.getInstance();
            boolean check = usuarioD.logar(login, senha);
            
            if(check){
                
                
                //AQUI --> INICIAR A TELA PRINCIPAL DO SISTEMA!
                return true;
                
            }else{
                System.out.println("Dados incorretos! Acesso negado ao sistema!");
                return false;
            }
        } catch (SQLException ex) {
            Logger.getLogger(usuarioController.class.getName()).log(Level.SEVERE, null, ex);
            return false;
        }
         
    }
    
    
    public static usuarioController getInstance(){
        if(instance == null){
            instance = new usuarioController();
        }
        return instance;
    }
    
    public static void kilInstance(){
        instance = null;
    }
    
}
